package cn.xopencode.recordservice.manager.maintransformer;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.maintransformer.MainTransformerRecordConvert;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.rpc.maintransformer.dto.MainTransformerRecordCreateDTO;
import cn.xopencode.recordservice.rpc.maintransformer.dto.MainTransformerRecordPageDTO;
import cn.xopencode.recordservice.rpc.maintransformer.dto.MainTransformerRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.maintransformer.vo.MainTransformerRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.maintransformer.vo.MainTransformerRecordPageVO;
import cn.xopencode.recordservice.rpc.maintransformer.vo.MainTransformerRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.service.maintransformer.MainTransformerRecordService;
import cn.xopencode.recordservice.service.maintransformer.bo.MainTransformerRecordCreateBO;
import cn.xopencode.recordservice.service.maintransformer.bo.MainTransformerRecordUpdateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 主变巡检记录
 */
@Service
public class MainTransformerRecordManager {

    @Autowired
    private MainTransformerRecordService mainTransformerRecordService;

    public Integer createMainTransformerRecord(MainTransformerRecordCreateDTO createDTO) {
        MainTransformerRecordCreateBO bo = MainTransformerRecordConvert.INSTANCE.convert(createDTO);
        Integer result = mainTransformerRecordService.createMainTransformerRecord(bo, createDTO.getEmpIds());
        return result;
    }

    public PageResult<MainTransformerRecordPageVO> pageMainTransformerRecord(MainTransformerRecordPageDTO pageDTO) {
        PageResult<MainTransformerRecordPageVO> boPageResult = mainTransformerRecordService.pageMainTransformerRecord(MainTransformerRecordConvert.INSTANCE.convert(pageDTO));
        return boPageResult;
    }

    public MainTransformerRecordUpdateVO getMainTransformerRecordById(String id){
        MainTransformerRecordUpdateVO updateVO = mainTransformerRecordService.getMainTransformerRecordById(id);
        return updateVO;
    }

    public Integer updateMainTransformerRecord(MainTransformerRecordUpdateDTO updateDTO) {
        MainTransformerRecordUpdateBO bo = MainTransformerRecordConvert.INSTANCE.convert(updateDTO);
        return mainTransformerRecordService.updateMainTransformerRecord(bo, updateDTO.getEmpIds());
    }

    public Integer dealMainTransformerRecordException(String recordId){
        return mainTransformerRecordService.dealMainTransformerRecordException(recordId);
    }

    public PageResult<MainTransformerRecordAdminPageVO> getAdminPageMainTransformerRecord(AdminRecordPageDTO pageDTO){
        return mainTransformerRecordService.getAdminPageMainTransformerRecord(AdminRecordConvert.INSTANCE.convert(pageDTO));
    }
}
